Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use better trimming message in ValidationContext #84326

Merged
merged 3 commits into from
Apr 6, 2023
Merged

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Apr 4, 2023

Add more details about why ValidationContext requires unreferenced code.

Fix #84324

Add more details about why ValidationContext requires unreferenced code.
@ghost
Copy link

ghost commented Apr 4, 2023

Tagging subscribers to this area: @dotnet/area-system-componentmodel-dataannotations
See info in area-owners.md if you want to be subscribed.

Issue Details

Add more details about why ValidationContext requires unreferenced code.

Author: eerhardt
Assignees: -
Labels:

area-System.ComponentModel.DataAnnotations

Milestone: -

@eerhardt
Copy link
Member Author

eerhardt commented Apr 4, 2023

The build is failing with

CP0015: (NETCORE_ENGINEERING_TELEMETRY=Build) Cannot change arguments of attribute 'System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute' on 'System.ComponentModel.DataAnnotations.ValidationContext.ValidationContext(object)'.

@ViktorHofer - is it possible to put RequiresUnreferencedCodeAttribute in a list that says it is not a breaking change to change the message of the attribute?

@ericstj
Copy link
Member

ericstj commented Apr 5, 2023

is it possible to put RequiresUnreferencedCodeAttribute in a list that says it is not a breaking change to change the message of the attribute?

You can do that here: https://github.com/dotnet/runtime/blob/1145e01c0165b92f97fe77e616aa0cf755079b1c/eng/ApiCompatExcludeAttributes.txt

If you also want to exclude from the generation of reference assemblies, that should go here: https://github.com/dotnet/runtime/blob/1145e01c0165b92f97fe77e616aa0cf755079b1c/eng/DefaultGenApiDocIds.txt

@eerhardt
Copy link
Member Author

eerhardt commented Apr 5, 2023

You can do that here

Will this exclude the message or the whole attribute from being analyzed? Once an assembly is annotated, adding RequiresUnreferencedCode is kind of a breaking change (since you will start getting warnings in trimmed apps). But for libraries that haven't been annotated yet, we don't want it to complain (or would just baseline the api compat warning).

If it isn't possible to just exclude the message from the compat check, maybe we can just exclude the whole attribute for now.

If you also want to exclude from the generation of reference assemblies

Good to know. But we definitely want these in the ref assemblies.

@eerhardt
Copy link
Member Author

eerhardt commented Apr 6, 2023

Failure is #83655.

@eerhardt eerhardt merged commit c93a93b into main Apr 6, 2023
@eerhardt eerhardt deleted the eerhardt-patch-1 branch April 6, 2023 14:31
@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants